Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Custom Pre- and Post- Log Hooks #483

Merged
merged 4 commits into from
Dec 27, 2022

Conversation

aqeelat
Copy link
Member

@aqeelat aqeelat commented Dec 19, 2022

Rebase of #275

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Merging #483 (7b6aa6c) into master (bc6d393) will increase coverage by 0.30%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #483      +/-   ##
==========================================
+ Coverage   93.24%   93.55%   +0.30%     
==========================================
  Files          29       29              
  Lines         859      869      +10     
==========================================
+ Hits          801      813      +12     
+ Misses         58       56       -2     
Impacted Files Coverage Δ
auditlog/diff.py 97.14% <100.00%> (+2.93%) ⬆️
auditlog/receivers.py 100.00% <100.00%> (ø)
auditlog/signals.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

auditlog/diff.py Outdated
@@ -98,7 +99,9 @@ def mask_str(value: str) -> str:
return "*" * mask_limit + value[mask_limit:]


def model_instance_diff(old, new, fields_to_check=None):
def model_instance_diff(
old: Union[Model, None], new: Union[Model, None], fields_to_check=None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Optional instead of Union here

self.assertSignals(LogEntry.Action.UPDATE)

@patch("auditlog.receivers.LogEntry.objects")
def test_signals_errors(self, log_entry_objects_mock):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great to test also the post_log signal here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're all tested already.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the error in post_log. Did I miss it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see what you mean. Tbh, initially, I just copied the tests as-is from the other PR. I just went over it now and updated a few things and added the test you suggested.

@hramezani
Copy link
Member

hramezani commented Dec 23, 2022

Thanks @aqeelat for this patch.
I left some comments
Please rebase the patch and add a changelog entry

@aqeelat
Copy link
Member Author

aqeelat commented Dec 24, 2022 via email

@hramezani
Copy link
Member

You will send the error to signal handler, I mean testing the error that is sent to the signal handler.
You did it in previous tests

@hramezani
Copy link
Member

Thanks @aqeelat

@hramezani hramezani merged commit c65c38e into jazzband:master Dec 27, 2022
@aqeelat aqeelat deleted the more_signals branch December 29, 2022 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants